Skip to content

Fix some invalid DT property types#2891

Merged
dlech merged 12 commits intoanalogdevicesinc:mainfrom
dlech:adi-fix-invalid-dt-props
Sep 16, 2025
Merged

Fix some invalid DT property types#2891
dlech merged 12 commits intoanalogdevicesinc:mainfrom
dlech:adi-fix-invalid-dt-props

Conversation

@dlech
Copy link
Copy Markdown
Collaborator

@dlech dlech commented Aug 11, 2025

PR Description

I was trying to run make dtbs_check on the ADI tree but it was causing the dtschma tool to crash. This lead me to devicetree-org/dt-schema#151 which lead me to running dt-extract-props -d Documentation/devicetree/bindings/. This revealed quite a few errors. I fixed some things where it told me the actual file name where the problem was for things that are only in the ADI tree.

The main one though is the last patch which fixes a problem likely from the upstream xilinx tree. I suppose we could submit that patch there, but I think it is important to fix it here ASAP so we can actually use make dtbs_check without crashing.

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

dlech added 7 commits August 11, 2025 14:29
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml: ignoring, error in schema: properties: clocks: maxItems

Use correct description property for the clocks node.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.yaml: ignoring, error in schema: properties: in-gpios: description

The description property is a string, not an array of strings.

Signed-off-by: David Lechner <dlechner@baylibre.com>
…property

Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/adc/adi,adar1000.yaml: adi,phasetable-name: missing type definition

All vendor-specific properties need to have a type defined.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/adc/adi,ad9083.yaml: jesd204-top-device: missing type definition
    Documentation/devicetree/bindings/iio/adc/adi,ad9083.yaml: jesd204-link-ids: missing type definition

All vendor-specific properties need to have a type defined.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/frequency/adf4371.yaml: adi,spi-3wire-enable: missing type definition
    Documentation/devicetree/bindings/iio/frequency/adf4371.yaml: adi,muxout-level-1v8-enable: missing type definition
    Documentation/devicetree/bindings/iio/frequency/adf4371.yaml: adi,output-enable: missing type definition

All vendor-specific properties need to have a type defined.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-mode: missing type definition
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-frm-buf-nr: missing type definition
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-distance: missing type definition
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-line-stride: missing type definition
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-frm-stride: missing type definition
    Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml: adi,flock-dwidth: missing type definition

All vendor-specific properties need to have a type defined.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/clock/clk-ad9545.yaml: assigned-clock-phases: missing type definition

All vendor-specific properties need to have a type defined.

Signed-off-by: David Lechner <dlechner@baylibre.com>
dlech added 3 commits August 11, 2025 16:17
…ties

Fix invalid binding found by:

    $ dt-extract-properties -d Documentation/devicetree/bindings/
    ...
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,loop-filter-pfd-frequency-hz: multiple incompatible types: uint32
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,loop-filter-pfd-frequency-hz: multiple incompatible types: uint32-matrix
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,vco-minimum-frequency-hz: multiple incompatible types: uint32
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,vco-minimum-frequency-hz: multiple incompatible types: uint32-matrix
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,vco-maximum-frequency-hz: multiple incompatible types: uint32
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,vco-maximum-frequency-hz: multiple incompatible types: uint32-matrix
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,power-up-frequency-hz: multiple incompatible types: uint32
    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml: adi,power-up-frequency-hz: multiple incompatible types: uint32-matrix

Properties don't use allOf: to define it's members.

Also fix all other dt_binding_check warnings in this file.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Remove the $ref from the reg property that assigns a type to it. This
is a standard property with type of "address", so assigning a different
type causes a conflict and even causes the dtschema tool to crash when
running `make dtbs_check`.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Drop unnecessary quotes around a couple of strings. This is the
preferred style upstream.

Signed-off-by: David Lechner <dlechner@baylibre.com>
@dlech dlech force-pushed the adi-fix-invalid-dt-props branch from a53dba4 to bc633f0 Compare August 11, 2025 21:19
dlech added 2 commits August 11, 2025 16:30
Fix property types not matching the example or the kernel driver.

Also fix a wrong name in required and remove an unspecified property
in the example.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Fix bindings errors found by make dt_binding_check.

Signed-off-by: David Lechner <dlechner@baylibre.com>
@dlech
Copy link
Copy Markdown
Collaborator Author

dlech commented Aug 11, 2025

I added a few more commits to clean up some existing dt_bindings_check problems that CI is complaining about. Could probably keep doing this for days though so at some point we'll have to call it good enough.

One thing I couldn't reproduce locally though is that the CI is failing with:

 Documentation/devicetree/bindings/clock/clk-ad9545.example.dts:18:18: fatal error: dt-bindings/clock/ad9545.h: No such file or directory
   18 |         #include <dt-bindings/clock/ad9545.h>

I can't see anything wrong with this and it is happening in other files as well, so I think this could be an issue with CI in this case rather than an actual problem.

@nunojsa
Copy link
Copy Markdown
Collaborator

nunojsa commented Aug 12, 2025

I can't see anything wrong with this and it is happening in other files as well, so I think this could be an issue with CI in this case rather than an actual problem.

@gastmaier something you can look up?

@nunojsa
Copy link
Copy Markdown
Collaborator

nunojsa commented Aug 12, 2025

The main one though is the last patch which fixes a problem likely from the upstream xilinx tree. I suppose we could submit that patch there, but I think it is important to fix it here ASAP so we can actually use make dtbs_check without crashing.

Yes, any xilinx code we touch should be sent to them... I'm ok with merging it in the meantime though

@gastmaier
Copy link
Copy Markdown
Collaborator

gastmaier commented Aug 18, 2025

Hi @dlech and @nunojsa , dt-bindings/clock/ad9545.h doesn't exist on linux-next/master and this step checkouts this branch + the touched files.
We do this to get the latests rules and checks.
I'm open for suggestions, like, checkout include files that doesn't exist on linux-next/master but does at the branch under checking? I don't think extra includes would hurt.

comm -13 <(git ls-tree -r --name-only public/mirror/next/linux-next/master include/
dt-bindings | sort)          <(git ls-tree -r --name-only @ include/dt-bindings | sort)
output

include/dt-bindings/clock/ad9545.h
include/dt-bindings/clock/xlnx-versal-net-clk.h
include/dt-bindings/drm/mipi-dsi.h
include/dt-bindings/iio/adc/adi,ad9081.h
include/dt-bindings/iio/adc/adi,ad9083.h
include/dt-bindings/iio/adc/adi,ad9208.h
include/dt-bindings/iio/adc/adi,ad9361.h
include/dt-bindings/iio/adc/adi,ad9371.h
include/dt-bindings/iio/adc/adi,adrv9002.h
include/dt-bindings/iio/adc/adi,adrv9009.h
include/dt-bindings/iio/adc/adi,adrv9025.h
include/dt-bindings/iio/adi,adl5580.h
include/dt-bindings/iio/frequency/ad9508.h
include/dt-bindings/iio/frequency/ad9528.h
include/dt-bindings/iio/frequency/adf4159.h
include/dt-bindings/iio/frequency/hmc7044.h
include/dt-bindings/jesd204/adxcvr.h
include/dt-bindings/jesd204/device-states.h
include/dt-bindings/power/xlnx-versal-net-power.h
include/dt-bindings/power/xlnx-versal-power.h
include/dt-bindings/power/xlnx-versal-regnode.h
include/dt-bindings/reset/xlnx-versal-net-resets.h

On the other hand, if these fixes fix make dtbs_check , then we may drop checking out linux-next/master ...

@gastmaier
Copy link
Copy Markdown
Collaborator

Running dt_binding_check on the commit range without checkout, results in the following outputs, without the tool crashing as before

Testing devicetree binding Documentation/devicetree/bindings/clock/clk-ad9545.yaml
  SCHEMA  Documentation/devicetree/bindings/processed-schema.json
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/crypto/fsl,sec-v4.0.yaml: fsl,liodn: multiple incompatible types: uint32
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/soc/fsl/fsl,qman.yaml: fsl,liodn: multiple incompatible types: uint32-array
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/soc/fsl/fsl,qman-portal.yaml: fsl,liodn: multiple incompatible types: uint32-array
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/soc/fsl/fsl,bman.yaml: fsl,liodn: multiple incompatible types: uint32-array
Warning: Duplicate compatible "io-channel-mux" found in schemas matching "$id":
        http://devicetree.org/schemas/iio/multiplexer/io-gen-mux.yaml#
        http://devicetree.org/schemas/iio/multiplexer/io-channel-mux.yaml#
  CHKDT   Documentation/devicetree/bindings
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/clock/clk-ad9545.example.dts
  DTC [C] Documentation/devicetree/bindings/clock/clk-ad9545.example.dtb
Testing devicetree binding Documentation/devicetree/bindings/iio/adc/adi,ad9083.yaml
  CHKDT   Documentation/devicetree/bindings
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/adc/adi,ad9083.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/adc/adi,ad9083.example.dtb
Testing devicetree binding Documentation/devicetree/bindings/iio/adc/adi,adar1000.yaml
  CHKDT   Documentation/devicetree/bindings
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/adc/adi,adar1000.yaml: 'oneOf' conditional failed, one must be fixed:
        'unevaluatedProperties' is a required property
        'additionalProperties' is a required property
        hint: Either unevaluatedProperties or additionalProperties must be present
        from schema $id: http://devicetree.org/meta-schemas/core.yaml#
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dts:20.11-21: Warning (reg_format): /example-0/adar1000@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/adc/adi,adar1000.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
::error file=Documentation/devicetree/bindings/iio/adc/adi,adar1000.yaml,line=0::dt_binding_check contain errors
Testing devicetree binding Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml
  CHKDT   Documentation/devicetree/bindings
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml: 'oneOf' conditional failed, one must be fixed:
        'unevaluatedProperties' is a required property
        'additionalProperties' is a required property
        hint: Either unevaluatedProperties or additionalProperties must be present
        from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
         $id: http://devicetree.org/schemas/bindings/iio/adc/ltc2387.yaml
        file: /mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.example.dtb
Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.example.dts:18.18-28.11: Warning (unit_address_vs_reg): /example-0/ltc2387@0: node has a unit name, but no reg or ranges property
::error file=Documentation/devicetree/bindings/iio/adc/lltc,ltc2387.yaml,line=0::dt_binding_check contain errors
Testing devicetree binding Documentation/devicetree/bindings/iio/adc/xlnx,versal-sysmon.yaml
  CHKDT   Documentation/devicetree/bindings
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/adc/xlnx,versal-sysmon.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/adc/xlnx,versal-sysmon.example.dtb
Testing devicetree binding Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.yaml
  CHKDT   Documentation/devicetree/bindings
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.yaml: 'oneOf' conditional failed, one must be fixed:
        'unevaluatedProperties' is a required property
        'additionalProperties' is a required property
        hint: Either unevaluatedProperties or additionalProperties must be present
        from schema $id: http://devicetree.org/meta-schemas/core.yaml#
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.example.dtb
Error: Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.example.dts:50.1-2 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.dtbs:131: Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.example.dtb] Error 1
make[1]: *** [/mnt/wsl/data/repos/linux-factory/Makefile:1442: dt_binding_check] Error 2
make: *** [Makefile:224: __sub-make] Error 2
::error file=Documentation/devicetree/bindings/iio/addac/adi,one-bit-adc-dac.yaml,line=0::dt_binding_check contain errors
Testing devicetree binding Documentation/devicetree/bindings/iio/frequency/adf4371.yaml
  CHKDT   Documentation/devicetree/bindings
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/frequency/adf4371.yaml: patternProperties:^channel@[01]$:properties:adi,output-enable:maxItems: False schema does not allow 1
        hint: Scalar properties should not have array keywords
        from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/frequency/adf4371.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/frequency/adf4371.example.dtb
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/frequency/adf4371.example.dtb: frequency@0 (adi,adf4371): channel@0:adi,power-up-frequency: [1, 3705032704] is too long
        from schema $id: http://devicetree.org/schemas/iio/frequency/adf4371.yaml#
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/frequency/adf4371.example.dtb: frequency@0 (adi,adf4371): Unevaluated properties are not allowed ('channel@2', 'channel@3' were unexpected)
        from schema $id: http://devicetree.org/schemas/iio/frequency/adf4371.yaml#
::error file=Documentation/devicetree/bindings/iio/frequency/adf4371.yaml,line=0::dt_binding_check contain errors
Testing devicetree binding Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml
  CHKDT   Documentation/devicetree/bindings
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/iio/frequency/adi,adf4360.example.dts
  DTC [C] Documentation/devicetree/bindings/iio/frequency/adi,adf4360.example.dtb
/mnt/wsl/data/repos/linux-factory/Documentation/devicetree/bindings/iio/frequency/adi,adf4360.example.dtb: pll@0 (adi,adf4360-7): 'adi,loop-filter-charge-pump-current' does not match any of the regexes: '^pinctrl-[0-9]+$'
        from schema $id: http://devicetree.org/schemas/iio/frequency/adi,adf4360.yaml#
::error file=Documentation/devicetree/bindings/iio/frequency/adi,adf4360.yaml,line=0::dt_binding_check contain errors
Testing devicetree binding Documentation/devicetree/bindings/media/adi,adi-axi-fb.yaml
  CHKDT   Documentation/devicetree/bindings
  LINT    Documentation/devicetree/bindings
  DTEX    Documentation/devicetree/bindings/media/adi,adi-axi-fb.example.dts
  DTC [C] Documentation/devicetree/bindings/media/adi,adi-axi-fb.example.dtb
github_env:: step_fail_dt_binding_check=true

Let me know if we merge this and drop checking out, or merge the include checkout propesed in #2899

@dlech
Copy link
Copy Markdown
Collaborator Author

dlech commented Aug 18, 2025

On the other hand, if these fixes fix make dtbs_check , then we may drop checking out linux-next/master ...

I think it would be best to check against the current branch instead of linux-next, otherwise anything that hasn't been upstreamed yet can't be validated.

@dlech
Copy link
Copy Markdown
Collaborator Author

dlech commented Aug 18, 2025

Yes, any xilinx code we touch should be sent to them... I'm ok with merging it in the meantime though

I don't see it on github yet, but I got an email that this patch has been applied to the xilinx tree.

@dlech
Copy link
Copy Markdown
Collaborator Author

dlech commented Aug 18, 2025

I think it would be best to check against the current branch instead of linux-next, otherwise anything that hasn't been upstreamed yet can't be validated.

Ah, I just now saw the proposed solution and it is the best of both. 👍

@gastmaier gastmaier closed this Aug 19, 2025
@gastmaier gastmaier reopened this Aug 19, 2025
@dlech dlech mentioned this pull request Sep 16, 2025
6 tasks
Copy link
Copy Markdown
Collaborator

@gastmaier gastmaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this solves the crash in dtschema@fixup_addresses python script todue to

# ...
# dac@0 {'compatible': ['adi,ad5413'], 'reg': [0], ... Ok
#  compatible ['adi,ad5413'] Ok
#  reg [0] Nok
    while i < len(val):
              ^^^^^^^^
TypeError: object of type 'sized_int' has no len()

The issue happens here
dtschema/dtb.py#L512

Due to uint32 being added as a type to reg, {'uint32', 'address'}, while the correct is only {'address'},

@dlech dlech merged commit a144be2 into analogdevicesinc:main Sep 16, 2025
51 of 55 checks passed
@dlech dlech deleted the adi-fix-invalid-dt-props branch September 16, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants